#pragma once

#include "NeroEngine\NResource.h"
#include "Device.h"

namespace Graphics
{
class Texture : public Engine::NResource
{
	RTTI_DECLARATIONS(Texture, Engine::NResource);

public:
	Texture(void);

	Texture(const std::string& instanceName, ID3D11ShaderResourceView* mTexture);

	Texture(const std::string& instanceName, const std::string& filePath);
	
	virtual ~Texture(void);

	virtual bool Initialize();

	virtual void Deinitialize();

#ifdef DX_9
	LPDIRECT3DTEXTURE9 GetResource();
#elif defined(DX_11)
	ID3D11ShaderResourceView* GetResource();
#endif

private:
#ifdef DX_9
	LPDIRECT3DTEXTURE9 mTexture;
#elif defined(DX_11)
	ID3D11ShaderResourceView* mTexture;
#endif
};

#ifdef DX_11
class TextureArray
{
public:
	typedef std::vector<Texture*> Textures;

public:
	TextureArray();

	~TextureArray();

	Texture* operator[](unsigned int index);
	
	bool Initialize(int size);
	
	void Deinitialize();

	bool AddTexture(const char* textureName);

	bool AddTexture(Texture* texture);

	Textures& GetTextures();

	int Size(){ return mTextures.size(); }

private:
	Textures mTextures;
};	
#endif
}